<template>
  <el-table ref="table" :data="result.data" v-loading="loading" v-on="$listeners" v-bind="$attrs"
            element-loading-text="拼命加载中"
            element-loading-spinner="el-icon-loading"
            element-loading-background="rgba(0, 0, 0, 0.8)">
    <el-table-column prop="id" label="ID">
    </el-table-column>
    <el-table-column prop="name" label="名称">
    </el-table-column>
    <el-table-column prop="no" label="编号">
    </el-table-column>
    <el-table-column prop="marketPrice" label="市场价">
    </el-table-column>
    <el-table-column prop="price" label="当前价格">
    </el-table-column>
    <el-table-column prop="description" label="描述">
    </el-table-column>
    <el-table-column prop="enabled" label="上架">
    </el-table-column>
    <el-table-column prop="hits" label="点击率">
    </el-table-column>
    <el-table-column prop="cdt" label="录入时间" :formatter="cdtFormatter">
    </el-table-column>
  </el-table>
</template>

<script>
  import utils from "@/bianmaba-exteneds/modules/utils"
  import {ElTable} from "element-ui";

  export default {
    name: "ExtendTable",
    extends: ElTable,
    methods: {
      handlePageSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentPageChange(val) {
        console.log(`当前页: ${val}`);
      },
      cdtFormatter: function (row, col, value) {
        return utils.dateFormat(value, "yyyy/MM/dd");
      }
    },
    data() {
      return {loading: true, result: {data: []}};
    }, mounted() {

      var that = this;

      let params = {pageable: {page: 0, size: 2}};
      this.ajax.post("/management/product/query", params).then(resp => {
        if (resp && resp.data && resp.data.success == true) {
          that.result = resp.data;
          that.loading = false;
          console.log(this.result)
        }
      })
      console.log("extend");
    }
  }

</script>

<style scoped>

</style>
